﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ShootSearch.Logger
{
    #region 日志消息
    public class LogMessage
    {
        private LogMessageType messageType;
        private string content;

        /// <summary>
        /// 消息类型
        /// </summary>
        public LogMessageType MessageType { get { return messageType; } }
        /// <summary>
        /// 消息内容
        /// </summary>
        public string Content { get { return content; } }

        /// <summary>
        /// 构造一条消息
        /// </summary>
        /// <param name="msg">消息内容</param>
        /// <param name="args">消息参数</param>
        public LogMessage(object msg, params object[] args)
        {
            messageType = LogMessageType.Info;
            this.content = string.Format(msg.ToString(), args);
        }

        /// <summary>
        /// 构造一条消息
        /// </summary>
        /// <param name="messageType">消息参数</param>
        /// <param name="msg">消息内容</param>
        /// <param name="args">消息参数</param>
        public LogMessage(LogMessageType messageType, object msg, params object[] args)
        {
            this.messageType = messageType;
            this.content = string.Format(msg.ToString(), args);
        }
    } 
    #endregion

    #region 日志信息类型
    /// <summary>
    /// 日志信息类型
    /// </summary>
    public enum LogMessageType
    {
        /// <summary>
        /// 调试类型
        /// </summary>
        Debug,
        /// <summary>
        /// 提示类型
        /// </summary>
        Info,
        /// <summary>
        /// 警告类型
        /// </summary>
        Warn,
        /// <summary>
        /// 错误类型
        /// </summary>
        Error,
        /// <summary>
        /// 严重错误类型
        /// </summary>
        Fatal
    } 
    #endregion
}
